package com.app.miwawa.api.system.entity.center;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.framework.common.api.entity.CommonEntityUUID;
import org.framework.common.ext.util.StringUtil;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 系统管理－用户
 * <p>描述: </p>
 * <p>Company: Professional</p>
 * @author chanlong(陈龙)
 * @date 2016年3月28日 上午11:52:44
 * @version 1.0.2016
 */
@Entity @Table(name = "TB_SYSTEM_USERS")
public class Users extends CommonEntityUUID {

	/** serialVersionUID(long):. */
	private static final long serialVersionUID = -8639193277257217706L;
	
	// 性别
	@Column(name = "sex", length = 5, nullable = true)
	private String sex;
	
	// 类型（全职、兼职）
	@Column(name = "type", length = 10, nullable = true)
	private String type;
	
	// 工号
	@Column(name = "code", length = 50, nullable = true)
	private String code;
		
	// 姓名
	@Column(name = "name", length = 50, nullable = true)
	private String name;
	
	// 老师昵称
	@Column(name = "nick", length = 50, nullable = true)
	private String nick;
	
	// 岗位（销售、老师、行政）
	@Column(name = "post", length = 10, nullable = true)
	private String post;
	
	// 职务
	@Column(name = "duty", length = 10, nullable = true)
	private String duty;
	
	// 邮箱
	@Column(name = "email", length = 50, nullable = true)
	private String email;
	
	// 手机
	@Column(name = "mobile", length = 50, nullable = true)
	private String mobile;
	
	// 帐号
	@Column(name = "account", length = 50, nullable = true)
	private String account;
	
	// 密码
	@Column(name = "password", length = 50, nullable = true)
	private String password;
	
	// 证件号
	@Column(name = "idcard_no", length = 50, nullable = true)
	private String idcardno;
	
	// 证件类别
	@Column(name = "idcard_type", length = 10, nullable = true)
	private String idcardtype;
	
	// 介绍
	@Lob @Basic(fetch=FetchType.LAZY)
	@Column(name = "description", nullable = true)
	private String description;
	
	// 创建时间（创立时间）
	@Temporal(TemporalType.DATE)
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@Column(name = "create_date", nullable = true)
	private Date createDate;
	
	// 老师用户图像
	@Column(name = "picture", length = 500, nullable = true)
	private String picture;

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNick() {
		return nick;
	}

	public void setNick(String nick) {
		this.nick = nick;
	}

	public String getPost() {
		return post;
	}

	public void setPost(String post) {
		this.post = post;
	}

	public String getDuty() {
		return duty;
	}

	public void setDuty(String duty) {
		this.duty = duty;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password == null ? password : password.length() >= 32 ? password : StringUtil.password(password);
	}

	public String getIdcardno() {
		return idcardno;
	}

	public void setIdcardno(String idcardno) {
		this.idcardno = idcardno;
	}

	public String getIdcardtype() {
		return idcardtype;
	}

	public void setIdcardtype(String idcardtype) {
		this.idcardtype = idcardtype;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}
}
